package itesm.mx;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

public class CapitalsQuizActivity extends QuizActivity {
	protected String[] capitals;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.quiz);
		countries = getResources().getStringArray(R.array.european_countries);
		capitals = getResources().getStringArray(R.array.european_capitals);
		
		nextQuestion();
		displayQuestion();
	}
	
	protected void displayQuestion() {
		Button[] answerButtons = {
			(Button) findViewById(R.id.answer1),
			(Button) findViewById(R.id.answer2),
			(Button) findViewById(R.id.answer3),
			(Button) findViewById(R.id.answer4)
		};
		
		for (int i = 0; i < answerButtons.length; i++) {
			answerButtons[i].setText(capitals[currentQuestion[i]]);
			answerButtons[i].setOnClickListener(this);
		}
		
		String questionText = getResources().getString(R.string.capitals_question);
		questionText += " ";
		questionText += countries[currentAnswer];
		questionText += getResources().getString(R.string.question_terminator);
		
		TextView question = (TextView) findViewById(R.id.question);
		question.setText(questionText);
	}

	@Override
	protected void onFinish(int score) {
		updateStats(AndroidProject.QUIZ_CAPITALS, score);
	}
	
	
	protected int getId(){return 1;}
}
